interface DB {
    filterUsers(filter: (this: User) => boolean): User[];
}
interface User {
    admin:boolean
}

const db:DB ={
    filterUsers(filter: (this: User) => boolean): User[] {
        let obj={
            admin:false
        }
        let obj2={
            admin:true
        }
        return  [obj,obj2]
    }
}
const admins = db.filterUsers(function (this: User) {
    return this.admin;
});
console.log(admins)